home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
DMTDEMOS
/
SETATTR.DEM
< prev
next >
Wrap
Text File
|
1994-07-02
|
1KB
|
64 lines
program SetAttrSample;
uses crt, DMT;
var
Attrib : char;
Attributes : word;
FileName : string;
begin
Color( 7, 0 );
clrscr;
write( 'Set Attributes for, Enter filename : ' );
readln( FileName );
{ Get the current attributes for the file specified }
GetAttr( FileName, Attributes ); { Call GetAttr procedure }
writeln;
writeln('Available Attributes ');
writeln;
writeln('(1) Normal (4) Read only');
writeln('(2) Hidden (5) System ');
writeln('(3) Archive ');
writeln;
write('Select (1..5) : ');
repeat
Attrib := upcase( readkey );
until Attrib in['1'..'5'];
writeln(Attrib);
{ Add the attribute selected to the current attribute(s) }
case Attrib of
'1' : Attributes := $00; { Normal }
'2' : Attributes := Attributes or $02; { Hidden }
'3' : Attributes := Attributes or $20; { Archive }
'4' : Attributes := Attributes or $01; { Read Only }
'5' : Attributes := Attributes or $04; { System }
end;
SetAttr( FileName, Attributes ); { Call SetAttr procedure }
if ( ErrFlag ) then
begin
writeln( #7 );
writeln( ShowError( GetErrCode ) );
end
else
begin
writeln;
writeln( 'Done...' );
end;
GetEnter;
end.